package com.rybbaby.tss.platform.codeGenerate.service;


import com.rybbaby.tss.core.bean.TableBean;
import com.rybbaby.tss.core.bean.TableColumnBean;
import com.rybbaby.tss.core.code.generate.config.GenerateConfig;
import com.rybbaby.tss.core.web.service.IBaseService;
import org.hibernate.mapping.Table;

import java.sql.SQLException;
import java.util.List;

/**
 * @description 代码生成器Service
 *
 * @author 谢进伟
 *
 * @createDate 2016年2月3日 下午9:15:38
 */
public interface ICodeGenerateService extends IBaseService<Table> {
	
	public void autoGenCode(GenerateConfig gc) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException;
	
	/**
	 * 获取数据库所有catalog
	 * 
	 * @return
	 */
	public List<String> getAllCatalog() throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException;
	
	/**
	 * 读取指定的catalog中中所有表和视图
	 * 
	 * @return
	 * @throws ClassNotFoundException
	 * @throws InstantiationException
	 * @throws IllegalAccessException
	 * @throws SQLException
	 */
	public List<TableBean> getAllTable(String catalog) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException;
	
	/**
	 * 获取数据库指定表的所有列
	 * 
	 * @param catalog
	 *            表所在的catalog
	 * 
	 * @param tableName
	 *            表名
	 * @return
	 * @throws SQLException
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 * @throws ClassNotFoundException
	 */
	public List<TableColumnBean> getTableColumns(String catalog, String tableName) throws ClassNotFoundException , InstantiationException , IllegalAccessException , SQLException;
	
	/**
	 * 获取指定表的备注
	 * 
	 * @param catalog
	 *            方案
	 * @param tableName
	 *            表名
	 * @return
	 * @throws Exception
	 */
	public String getTableRemarks(String catalog, String tableName) throws Exception;
}
